package controllers;

import models.Usuario;
import play.data.validation.Required;
import play.mvc.Controller;

/**
 * Created with IntelliJ IDEA.
 * User: bicho
 * Date: 21/06/12
 * Time: 12:49
 * To change this template use File | Settings | File Templates.
 */
public class Login extends Controller {

    public static void index() {
        render();
    }

    public static void authenticate(@Required String correo, String password) throws Throwable {

        Usuario usuario = Usuario.find("byCorreoAndPassword", correo, password).first();
        if (usuario != null) {
            session.put("username", usuario.correo);
        }

    }
}
